<?php

use yii\db\Migration;
use yii\db\Schema;

/**
 * Class m180319_080854_ADD_FIELD_ROOM
 */
class m180319_080854_ADD_FIELD_ROOM extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->addColumn('{{room}}', 'balcony', Schema::TYPE_INTEGER. "(1)  DEFAULT  '2' COMMENT '1 有阳台 2 无阳台' ");
        $this->addColumn('{{room}}', 'balcony_area', Schema::TYPE_INTEGER. "(4)  DEFAULT  '0' COMMENT '阳台面积' ");

        $this->alterColumn('{{room}}', 'area', Schema::TYPE_STRING. "(16) NULL COMMENT '客房面积' ");
        $this->alterColumn('{{room}}', 'balcony_area', Schema::TYPE_STRING. "(16) NULL COMMENT '阳台面积' ");
        $this->addColumn('{{room}}', 'type', Schema::TYPE_INTEGER. "(1)  DEFAULT  '1' COMMENT '1内仓2海景3阳台4套房 5其它' ");
        $this->addColumn('{{room}}', 'min', Schema::TYPE_INTEGER. "(1)  DEFAULT  '1' COMMENT '最少入住人数' ");
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        echo "m180319_080854_ADD_FIELD_ROOM cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180319_080854_ADD_FIELD_ROOM cannot be reverted.\n";

        return false;
    }
    */
}
